register()
function register() {
  let username = document.querySelector('input[type="text"]')
  let psd = document.querySelector('.p1')
  let psdRepeat = document.querySelector('.p2')
  let userEmail = document.querySelector('input[type="email"]')
  let btn = document.querySelector('button')

  btn.onclick = function () {
    if (psd.value === psdRepeat.value) {
      if (window.confirm('注册成功，请前往登录。')) {
        localStorage.setItem('UNAME', username.value)
        localStorage.setItem('PWD', psd.value)
        location.href = './login.html'
      }
    }else{
      alert('密码有误，请重新输入。')
    }
  }


}